/*
	Simple Software Renderer (SSRenderer)
	Copyright (C) 2007 Piotr Orzechowski <piotr.orzechowski@gmail.com>

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef _ISSRDEVICE_H
#define _ISSRDEVICE_H

#include <cstdio>
#include "SSRTypes.h"
#include "ISSRObject.h"

namespace ssr
{

// Pre-declarations
class SSRRenderTarget;

/**
	ISSRDevice is an interface of display devices used with SSRenderer.

	Display device is responsible of creating a rendering context - that is,
	initializing a video driver, opening device window and creating a
	primary rendering target.

	During lifetime of an application, the device is used to flush video
	buffers on screen.
*/
class ISSRDevice :
	public ISSRObject
{
public:

	/**
		Creates an instance of the display device. This method
		is only used by a global function createDevice().

		@param width width of the device window
		@param height height of the device window
		@param pTitle NULL-ended string containing title of the window

		@return result integer code
	*/
	virtual s32 _CreateDevice(u32 width, u32 height, const char* pTitle) = 0;

	/**
		Sets fullscreen mode on/off.

		@param flag true - if fullscreen mode is requested, false - if window mode is requested
	*/
	virtual void ToggleFullscreen(bool flag) = 0;

	/**
		Causes device window to refresh (with primary rendering target content).
	*/
	virtual void FlushBuffers() = 0;

	/**
		Returns a pointer to the primary rendering target of the device.

		Important: GetRenderTarget() has to call SSR_ADDREF() on the
		pointer which will be returned.

		@return pointer to the primary rendering target
	*/
	virtual SSRRenderTarget* GetRenderTarget() const = 0;

	/**
		Returns a pointer to the NULL-ended string containing information
		on the current display device.

		@return NULL-ended string containing information on the current display device
	*/
	virtual const char* GetInfo() const = 0;

	/**
		Returns NULL-ended string containing name of the class.
		Satisfies ISSRObject implementation.

		@return NULL-ended string containing name of the class
	*/
	const u8* ClassName()
	{
		const static u8 name[] = "ISSRDevice\0";
		return name;
	}

protected:

	ISSRDevice() {}

	virtual ~ISSRDevice() {}

private:

};

} // namespace

#endif
